#ifndef _HAVE_FIELD_H
#define _HAVE_FIELD_H

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include "debug-inl.h"

enum FIELD_TYPE {
    FIELD_TYPE_INT,
    FIELD_TYPE_UINT,
    FIELD_TYPE_STRUCT,
    FIELD_TYPE_DENPENDENCY,
};
struct constaint {

};

union desc{
    struct dependency {
        char *depend_name;
    }dp;
    struct array {}ar;
    struct intvalue{}ival;
};
typedef struct field {
    char *name;
    uint8_t *value;
    int type;
    int count;
    union desc desc;
    struct constaint constaint;
    struct field *prev;
    struct field *next;
    struct field *parents;
    struct field *children;
} field_t;

field_t *field_new(void);
void field_free(field_t *field);
void field_insert_before(field_t *cur, field_t *field);
void field_insert_after(field_t *cur, field_t *field);
void field_remove(field_t *field);
void field_append(field_t *cur, field_t *field);
void field_prepend(field_t *cur, field_t *field);
void field_move_before(field_t *field);
void field_move_after(field_t *field);
void field_add_child(field_t *cur, field_t *child);
void field_add_parent(field_t *cur, field_t *parent);
field_t *field_get_header(field_t *field);
field_t *field_get_tail(field_t *field);
void field_show(field_t *field);
field_t *field_search_by_name(field_t *field, char *name);
int parse_data_by_fields(field_t *field, uint8_t **pdata);
#endif /* _HAVE_FIELD_H */
